#include "stdafx.h"

#include "Option.h"


const int MAX_STRING_SIZE = 1024;

Option::Option() {

	color_mb = NULL;
	font_mb = NULL;
	format_mb = NULL;
	this->setFont(_T("Arial"));
	this->setColor(_T("red"));
	this->quality = 90;
	this->overwrite = false;
	this->fontsize = 0;
}

Option::~Option() {

	if (color_mb != NULL) {
		delete[] color_mb;
	}
	if (font_mb != NULL) {
		delete[] font_mb;
	}
	color_mb = NULL;
}

char* Option::getColor() {
	return color_mb;
}

int Option::getQuality() {
	return quality;
}

void Option::setQuality(int quality) {
	this->quality = quality;
}


int Option::getFontSize() {
	return fontsize;
}

void Option::setFontSize(int fontSize) {
	this->fontsize = fontSize;
}

char* Option::getFont() {
	return font_mb;
}

void Option::setFont(const TCHAR* font) {
	this->font = font;
	CT2A ascii(font);
	if (font_mb != NULL) {
		delete[] font_mb;
	}
	font_mb = new char[MAX_STRING_SIZE];
	strcpy_s(font_mb, MAX_STRING_SIZE, ascii.m_psz);
}

char* Option::getFormat() {
	return format_mb;
}

CString Option::getFormatCS() {
	return format;
}
void Option::setFormat(const TCHAR* format) {
	this->format = format;
	CT2A ascii(format);
	if (format_mb != NULL) {
		delete[] format_mb;
	}
	format_mb = new char[MAX_STRING_SIZE];
	strcpy_s(format_mb, MAX_STRING_SIZE, ascii.m_psz);
}

void Option::setColor(const TCHAR* color) {
	this->color = color;
	CT2A ascii(color);
	if (color_mb != NULL) {
		delete[] color_mb;
	}
	color_mb = new char[MAX_STRING_SIZE];
	strcpy_s(color_mb, MAX_STRING_SIZE, ascii.m_psz);
}

void Option::setOverwrite(bool overwrite) {
	this->overwrite = overwrite;
}

bool Option::getOverwrite() {
	return this->overwrite;
}